<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath %>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>农资与农产品全程供应链物流平台-客户下单</title>
<meta name="kewywords" content="农资与农产品全程供应链物流平台"/>
<meta name="description" content="农资与农产品全程供应链物流平台"/>
<link href="css/style.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="js/jquery-1.9.1.js"></script>
	<script type="text/javascript">
		
		function saveCheck(val){
			if(val==1){
				if($("#sender").val() == ""||$.trim($("#sender").val()) == ""){
					$("#senderTip").html("<font color=\"red\">请填写寄方姓名</font>");
					return false;
				}else{
					$("#senderTip").html("<font color=\"red\"></font>");	
				}
				
			}
			if(val==2){
				if ("" == $("#sendertel").val() || $.trim($("#sendertel").val()) == "") {
					$("#phoneTip").html("<font color=\"red\">联系电话不能为空</font>");
					return false;
				} else {
					var s= $("#sendertel").val();
					var w = 0;   
					for (var i=0; i<s.length; i++) {   
					   var c = s.charCodeAt(i);   
					   //单字节加1   
					   if ((c >= 0x0001 && c <= 0x007e) || (0xff60<=c && c<=0xff9f)) {   
					    w++;   
					   }   
					   else {   
					    w+=2;   
					    
					   }   
					}   
					if (w==11) {   
						$("#phoneTip").html("<font color=\"red\"></font>");
					}else{
						$("#phoneTip").html("<font color=\"red\">联系电话必须是11位的数字</font>");
					}   
				}
			}
			if(val==3){
				if($("#senderfirm").val() == ""||$.trim($("#senderfirm").val()) == ""){
					$("#senderfirmTip").html("<font color=\"red\">请填写公司名称</font>");
					return false;
				}else{
					$("#senderfirmTip").html("<font color=\"red\"></font>");	
				}
				
			}
			if(val==4){
				if($("#senderaddr").val() == ""||$.trim($("#senderaddr").val()) == ""){
					$("#senderaddrTip").html("<font color=\"red\">请填写寄方地址</font>");
					return false;
				}else{
					$("#senderaddrTip").html("<font color=\"red\"></font>");	
				}
				
			}
			if(val==5){
				if($("#weight").val() == ""||$.trim($("#weight").val()) == ""){
					$("#weightTip").html("<font color=\"red\">请填写物品重量</font>");
					return false;
				}else{
					$("#weightTip").html("<font color=\"red\"></font>");	
				}
				
			}
		}			
			
		function saveChecks(){
			if($("#sender").val() == ""||$("#sendertel").val() == ""||$("#senderfirm").val() == ""||$("#senderaddr").val() == ""
					||$("#weight").val() == ""){
				alert("请把信息填写完整");
				return false;
			}else{
				$("#placeOrderInfo").submit();
			}
			
		}			
	</script>
</head>
<body>
<%@include file="top.jsp" %>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
	    <td width="187" height="37" bgcolor="#e0e0e0" class="brt bbt">
	    	<div class="topleft fl">系统菜单栏</div></td>
	    <td bgcolor="#e7e7e7" class=" bbt">
	    	<div class="topleft fl">
	    		您现在的位置：<a href="#">首页</a>&nbsp;>&nbsp;<span>客户下单</span>
	    	</div>
	    </td>
	</tr>
	<tr>
	    <td width="187" height="100%" valign="top" bgcolor="#FFFFFF" class="brt">
	    	<div class="left_bk">
				<div class="menu2">
	             <%@include file="order_left.jsp" %>        
	        	</div>
	        </div>
	    </td>
	    <td align="left" valign="top" bgcolor="#FFFFFF">
	    	<div class="content">
		    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
				<tr>
					<td height="38" style="background:url(images/zz_tit.jpg) left top repeat-x;">
						<div class="tt_back fl">客户下单</div>
						<div class="fr">
							<img src="images/tit_right.jpg" alt="" width="103" height="38" />
						</div>
					</td>
		        </tr>
		        <tr>
					<td class="borders btn">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td bgcolor="#fffeee" style="border-bottom:#fee7bd solid 1px;" >
								   	<form action="order/placeOrderSave.action" method="post" id="placeOrderInfo" >	
								   	<div style="height:460px">
								   	<s:hidden name="order.id"/>
								    <table border="0" cellspacing="0" cellpadding="0" align="left" style="margin-top:20px;margin-left: 100px;margin-bottom: 20px; " >
				                        <tr style="height: 40px;">
								  			<td align="right" width="200px;"><span style="color: red">*</span>寄方姓名：</td>
								  			<td  width="180px;">
								  				<input type="text" style="width: 200px;" class="input_are w122" id="sender" 
								  					name="order.sender" value="${order.sender}" onblur="saveCheck(1)"/>
								  					<span id="senderTip"></span></td>
								  		</tr>
								  		<tr style="height: 40px;">
								  			<td align="right"><span style="color: red">*</span>寄方电话：</td>
								  			<td width="180px;">
								  				<input type="text" style="width: 200px;" id="sendertel" class="input_are w122" 
								  					name="order.sendertel" value="${order.sendertel}" onblur="saveCheck(2)"/>
								  					<span id="phoneTip"></span></td>
								  		</tr>
								  		<tr style="height: 40px;">
								  			<td align="right"><span style="color: red">*</span>公司名称：</td>
								  			<td width="180px;">
								  				<input type="text"  style="width: 200px;" id="senderfirm" class="input_are w122" 
								  					name="order.senderfirm" value="${order.senderfirm}" onblur="saveCheck(3)"/>
								  					<span id="senderfirmTip"></span></td>
								  		</tr>
								  		<tr style="height: 40px;">
								  			<td align="right"><span style="color: red">*</span>地 址：</td>
								  			<td width="180px;">
								  				<input type="text"  style="width: 200px;" id="senderaddr" class="input_are w122" 
								  					name="order.senderaddr" value="${order.senderaddr}" onblur="saveCheck(4)"/>
								  					<span id="senderaddrTip"></span></td>
								  		</tr>
								  		<tr style="height: 40px;">
								  			<td align="right"><span style="color: red">*</span>物品重量（KG）：</td>
								  			<td width="180px;">
								  				<input type="text" style="width: 200px;" id="weight" class="input_are w122" 
								  					name="order.weight" value="${order.weight}" onblur="saveCheck(5)"/>
								  					<span id="weightTip"></span></td>
								  		</tr>
								  		<tr style="height: 40px;">
								  			<td align="right">订单备注：</td>
								  			<td width="180px;">
								  				<input type="text" style="width: 200px;" id="remark" class="input_are w122" 
								  					name="order.remark" value="${order.remark}" /></td>
								  		</tr>
								  		<!-- 
								  		<tr style="height: 40px;">
								  			<td align="right">收件员：</td>
								  			<td width="180px;"><input type="text" style="width: 200px;" id="vehicleColor" class="input_are w122" name="vehicle.vehicleColor" value="${vehicle.vehicleColor}" /></td>
								  		</tr>
								  		<tr style="height: 40px;">
								  			<td align="right">是否收件：</td>
								  			<td width="180px;">
								  			<input type="radio" value="" name="placeOrder"  />&nbsp;已收件&nbsp;&nbsp;&nbsp;
								  			<input type="radio" value="" name="placeOrder"  />&nbsp;未收件
								  			</td>
								  		</tr>
								  		<tr style="height: 40px;">
								  			<td align="right">收件时间：</td>
								  			<td  width="180px;">				  				
								  				<input type="text" id="length" style="width: 200px;"class="input_are w122"  name="vehicle.length" value="${vehicle.length}" size="10"/>
								  			</td>				  			
								  		</tr>
								  		 -->
								  		<tr style="height: 40px;">
								  			<td colspan="2" align="center">
								  			<input type="button" style="cursor: pointer;" class="buttons2" value="保 存" onclick="saveChecks()" />
								  			<input type="reset" style="cursor: pointer;" class="buttons2" value="重 置" /></td>
								  		</tr>
									</table>
									</div>
									</form>
								</td>
			  				</tr>
						</table>
					</td>
				</tr>
			</table>
			</div>
		</td>
	</tr>
</table>
<div class="bottom">版权所有：安徽朗坤物联网</div>
</body>
</html>